package com.zhou.project.components.base.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.sql.Timestamp;
import java.util.Date;

/**
 * @project spring-boot-project
 * @author zhouhonggang
 * @datetime 2021/8/14 16:18
 * @version 1.0.0
 * @description: 公共实体类(所有子模块必须继承)
 */
@Getter
@Setter
public class Base {
    /**
     * 主键
     */
    @TableId(type= IdType.AUTO)
    @ApiModelProperty(name = "id", value = "主键", required = true, dataType = "Integer")
    private Integer id;
    /**
     * 乐观锁(在并发操作时使用)
     */
    @TableField(update = "%s+1")
    @ApiModelProperty(name = "revision", value = "乐观锁", dataType = "Integer")
    private Integer revision = 1;
    /**
     * 删除状态 0:启用 1删除
     */
    @TableLogic
    @ApiModelProperty(name = "deleteFlag", value = "逻辑删除0:未删 1:已删", dataType = "Integer")
    private Integer deleteFlag = 0;
    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(name = "createdBy", value = "添加人员", required = true, dataType = "Integer")
    private Integer createdBy;
    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(name = "createdTime", value = "添加时间", required = true, dataType = "Timestamp")
    private Timestamp createdTime;
    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(name = "updatedBy", value = "修改人员", required = true, dataType = "Integer")
    private Integer updatedBy;
    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(name = "updatedTime", value = "修改时间", required = true, dataType = "Timestamp")
    private Timestamp updatedTime;
    /**
     * current: 起始页
     * size: 每页查询条数
     * 不参与数据库相关操作只负责分页查询相关功能
     */
    @TableField(exist = false)
    @ApiModelProperty(name = "current", value = "当前页", dataType = "Integer")
    private int current = 1;

    @TableField(exist = false)
    @ApiModelProperty(name = "size", value = "每页条数", dataType = "Integer")
    private int size = 10;

    @TableField(exist = false)
    private Date[] dates;
}
